﻿
using MaLu.Interfaces;
using MaLu.Data.SqlServer;
namespace MaLu.Data
{
    public sealed class SqlFactory : IFactory
    {

        private static IFaShare fashare = null;
        private static IBooth booth = null;
        private static IFertilizer fertilizer = null;
        private static ICold cold = null;
        private static IGreen green = null;
        private static IInputDataFileLog inputdatafilelog = null;
        private static IMembrane membrane = null;
        private static IPackage package = null;
        private static ILiving living = null;
        private static ISick sick = null;
        private static IStudy study = null;
        private static IDeformity deformity = null;
        private static IOther other = null;
        public IDbProvider CreateDbProvider()
        {
            return new SqlProvider();
        }

        public IDbHelper DbHelper
        {
            get { return SqlHelper.Instance; }
        }
        public IFaShare FaShare
        {
            get
            {
                if (fashare == null)
                    fashare = new SqlFaShare();
                return fashare;
            }
        }
        public IInputDataFileLog InputDataFileLog
        {
            get
            {
                if (inputdatafilelog == null)
                    inputdatafilelog = new SqlInputDataFileLog();
                return inputdatafilelog;
            }
        }

        public IBooth Booth
        {
            get
            {
                if (booth == null)
                    booth = new SqlBooth();
                return booth;
            }
        }

        public IFertilizer Fertilizer
        {
            get
            {
                if (fertilizer == null)
                    fertilizer = new SqlFertilizer();
                return fertilizer;
            }
        }

        public ICold Cold
        {
            get
            {
                if (cold == null)
                    cold = new SqlCold();
                return cold;
            }
        }
        public IGreen Green
        {
            get
            {
                if (green == null)
                    green = new SqlGreen();
                return green;
            }
        }

        public IMembrane Membrane
        {
            get
            {
                if (membrane == null)
                    membrane = new SqlMembrane();
                return membrane;
            }
        }

        public IPackage Package 
        {
            get
            {
                if (package == null)
                    package = new SqlPackage();
                return package;
            }
        }

        public ILiving Live
        {
            get
            {
                if (living == null)
                    living = new SqlLiving();
                return living;
            }
        }

        public ISick Sick
        {
            get
            {
                if (sick == null)
                    sick = new SqlSick();
                return sick;
            }
        }

        public IStudy Study
        {
            get
            {
                if (study == null)
                    study = new SqlStudy();
                return study;
            }
        }
        public IDeformity Deformity
        {
            get
            {
                if (deformity == null)
                    deformity = new SqlDeformity();
                return deformity;
            }
        }
        public IOther Other
        {
            get
            {
                if (other == null)
                    other = new SqlOther();
                return other;
            }
        }
    }
}
